home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 08 - 1992 / 08.02 Jun 92 / Generic Virus Detection / Exit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-26  |  821 b   |  33 lines  |  [TEXT/MPS ]

  1. /**** This file contains auxiliary (not directly related) functions and declarations for the Boyer-Moore and Dynamic listings */
  2.  
  3. /* exit.c : error handling and deallocation functions for dynamic */
  4.  
  5. #include "dec.h"
  6. #include "errors.h"
  7.  
  8. /* error_message : prints message to stderr before exiting */
  9. void error_message(error)
  10. ERROR_CODE error;           
  11. {                           
  12.   if (error)
  13.     fprintf(stderr, "Error %d: ", error);
  14.   switch (error) {
  15.     case NO_ERROR:         
  16.       break;              
  17.     default:
  18.       fprintf(stderr, UNKNOWN);
  19.       break;
  20.   }
  21. }
  22.  
  23. /* exit_cleanly : deallocate all allocated memory and quit */
  24. void exit_cleanly(error, exit_code)
  25. ERROR_CODE error;
  26. int exit_code;
  27. {
  28.   if (error)  /* print error message, if any */
  29.     error_message(error);
  30.   exit(exit_code);    /* quit */
  31. }
  32.  
  33.